package com.multition.demo02;

import java.text.NumberFormat;
import java.util.Locale;

/**
 * TODO java.text.NumberFormat 类提供了对百分比格式的支持
 */
public class PercentFormatTest {
    static public void displayPercent(Double amount, Locale currentLocale) {

        NumberFormat formatter;
        String amountOut;

        formatter = NumberFormat.getPercentInstance(currentLocale);
        amountOut = formatter.format(amount);

        System.out.println(amountOut + "   " + currentLocale.toString());
    }

    static public void main(String[] args) {
        displayPercent(new Double(4567.89), new Locale("en", "US"));
        displayPercent(new Double(4567.89), new Locale("de", "DE"));
        displayPercent(new Double(4567.89), new Locale("fr", "FR"));
    }
}
